#pragma once

#include "mysql_handle.h"

class MySQLPool;
class MySQLConnection
{
public:
    MySQLConnection(MySQLPool *pool, MySQLHandle *handle);
    ~MySQLConnection();

public:
    MYSQL *nativeHandle()
    {
        return handle_->nativeHandle();
    }

    void release();

    void        Create(const std::string &sql);
    void        Drop(const std::string &sql);
    uint64_t    Insert(const std::string &sql);
    void        InsertList(const std::string &sql);
    uint64_t    Update(const std::string &sql);
    uint64_t    Remove(const std::string &sql);
    MySQLResult Select(const std::string &sql);

private:
    MySQLHandle *handle_;
    MySQLPool   *pool_;
};